package o;

import android.content.Context;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.huawei.appgallery.foundation.ui.framework.cardframe.bean.BaseDetailResponse;
import com.huawei.appgallery.foundation.ui.framework.cardframe.bean.BaseDetailResponse.Layout;
import com.huawei.appgallery.foundation.ui.framework.cardframe.bean.BaseDetailResponse.LayoutData;
import com.huawei.appgallery.foundation.ui.framework.cardkit.widget.CardListAdapter;
import com.huawei.appgallery.wishwall.control.AbsSortedListAdapter;
import com.huawei.appgallery.wishwall.control.AppSelectionAdapterWrapper$1;
import com.huawei.appgallery.wishwall.ui.cardkit.bean.WishWallAppSelectionCardBean;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;

public class dds {
    private List<def> ˊ;
    private AbsSortedListAdapter ˋ;
    private List<? extends Map<String, ?>> ˎ;
    private Context ˏ;
    private cia ॱ;

    public dds(@NonNull Context context, @NonNull cia o_cia) {
        this.ˏ = context;
        this.ॱ = o_cia;
    }

    public void ॱ(@NonNull List<def> list, @Nullable String str, @NonNull CardListAdapter cardListAdapter) {
        this.ˎ = ॱ(list, str);
        this.ˋ = new AppSelectionAdapterWrapper$1(this, this.ˏ, this.ˎ, "INDEX_KEY", cardListAdapter);
    }

    private void ˋ(List<? extends Map<String, ?>> list) {
        this.ˊ = new ArrayList();
        for (Map map : list) {
            this.ˊ.add((def) map.get("DATA_KEY"));
        }
        BaseDetailResponse ˊ = ˊ(this.ˊ);
        this.ॱ.ॱॱ();
        new chg().ॱ(this.ॱ, new chd(), ˊ, true);
    }

    public AbsSortedListAdapter ॱ() {
        return this.ˋ;
    }

    @NonNull
    public List<def> ˊ() {
        return this.ˊ;
    }

    private List<? extends Map<String, ?>> ˎ() {
        return this.ˎ;
    }

    private static List<? extends Map<String, ?>> ॱ(List<def> list, String str) {
        if (str == null) {
            str = "";
        }
        CharSequence toLowerCase = str.toLowerCase(Locale.getDefault());
        List<? extends Map<String, ?>> arrayList = new ArrayList();
        for (def o_def : list) {
            Object obj;
            Map hashMap = new HashMap();
            String toLowerCase2 = o_def.ˏ().toLowerCase(Locale.getDefault());
            if (toLowerCase2.equals(toLowerCase)) {
                obj = "000000" + o_def.ˏ();
            } else if (toLowerCase2.contains(toLowerCase)) {
                obj = "000001" + o_def.ˏ();
            } else {
                obj = o_def.ˏ();
            }
            hashMap.put("INDEX_KEY", obj);
            hashMap.put("DATA_KEY", o_def);
            arrayList.add(hashMap);
        }
        return arrayList;
    }

    @NonNull
    private BaseDetailResponse ˊ(@NonNull List<def> list) {
        Layout layout = new Layout();
        layout.ॱ((long) 1);
        layout.ˋ(-1);
        layout.ˏ("wishwallreplycard");
        LayoutData layoutData = new LayoutData();
        layoutData.ˋ((long) 1);
        layoutData.ॱ("wishwallreplycard");
        List arrayList = new ArrayList();
        for (def o_def : list) {
            WishWallAppSelectionCardBean wishWallAppSelectionCardBean = new WishWallAppSelectionCardBean();
            wishWallAppSelectionCardBean.ˏˎ(o_def.ˋ());
            wishWallAppSelectionCardBean.appInfo = o_def;
            arrayList.add(wishWallAppSelectionCardBean);
        }
        layoutData.ॱ(arrayList);
        BaseDetailResponse baseDetailResponse = new BaseDetailResponse();
        arrayList = new ArrayList();
        arrayList.add(layout);
        baseDetailResponse.ˊ(arrayList);
        List arrayList2 = new ArrayList();
        arrayList2.add(layoutData);
        baseDetailResponse.ॱ(arrayList2);
        baseDetailResponse.ˏ(0);
        return baseDetailResponse;
    }
}
